<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="container">

    <my-input ref="myInputRef"/>
</div>

<script src="https://unpkg.com/vue@next"></script>
<script type="text/javascript">

    const demoApp = {
        data(){
            return {

            }
        },
        updated(){
            this.$refs.myInputRef.focus() // TODO: 为什么副组件调用不起作用？
        },
        methods:{

        }

    }

    Vue.createApp(demoApp)
        .component('my-input',{
            template:`<input ref="inputRef" type="text"/>`,
            mounted(){
                this.focusInput()
            },
            updated(){

            },
            methods:{
                focusInput(){
                    // this.$refs.inputRef.focus()
                }
            }
        })
        .mount('#container')
</script>

</body>
</html>
